package com.zyt.hadoop;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

/**
 * @author zyt
 * @createDate 2020/09/14 11:26 AM
 */
public class HadoopMapper extends Mapper<LongWritable, Text, IntWritable, NullWritable> {
    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        System.out.println("处理的数字为：" + value);
        IntWritable num = new IntWritable();
        num.set(Integer.parseInt(value.toString()));
        context.write(num, NullWritable.get());
    }
}
